﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public bool function(int a)//若是素数返回true，否则返回false
        {
            if (a <= 1)
            {
                return false;
            }
            for(int i = 2; i <= Math.Sqrt(a); i++)
            {
                if (a % i == 0)//不是素数
                {
                    return false;
                }
            }
            return true;
        }



        private void button1_Click(object sender, EventArgs e)
        {
            for(int a = 6; a <= 100; a+=2)
            {
                for(int i = 2; i <= a/2; i++)
                {
                    int j = a - i;
                    if (function(i) && function(j))
                    {
                        textBox1.Text += (a + "=" + i + "+" + j + "   ");
                    }
                }
                textBox1.Text += "\r\n";
            }
        }
    }
}
